import { CheckCircleOutlined, CloseCircleOutlined, UserOutlined } from "@ant-design/icons";
import { Avatar, Tag } from "antd";
import moment from "moment";

const columns = [
  {
    title: '',
    dataIndex: 'userImage',
    render: (url: string) => <Avatar size='large' icon={<UserOutlined />} src={url} />
  },
  {
    title: '审批人',
    dataIndex: 'zhName',
  },
  {
    title: '审批类型',
    dataIndex: 'operate',
    render: (type: string) => {
      switch (type) {
        case 'start':
          return <Tag icon={<CheckCircleOutlined />} color="success" >提交</Tag>
        case 'reject':
          return <Tag icon={<CloseCircleOutlined />} color="error" >驳回</Tag>
        default:
          return type
      }
    }
  },
  {
    title: '审批时间',
    dataIndex: 'date',
    render: (date: string) => moment(date).format('YYYY-MM-DD HH:mm:ss')
  },
  {
    title: '审批内容',
    dataIndex: 'opinion',
  }
]

export {
  columns
}
